import copy

# 浅拷贝
a = [1, 2, [3, 4]]
b = copy.copy(a)
a[2][0] = 5
print(a)  # [1, 2, [5, 4]]
print(b)  # [1, 2, [3, 4]]

# 查看内存地址：
print(id(a))  # 4471224800
print(id(b))  # 4471224768

print(id(a[2]))  # 1435630339264
print(id(b[2]))  # 1435630339264

# 深拷贝
a = [1, 2, [3, 4]]
b = copy.deepcopy(a)

a[2][0] = 5
print(a)  # [1, 2, [5, 4]]
print(b)  # [1, 2, [3, 4]]

print(id(a))
print(id(b))

